//
//  FQAnswerCollectionViewCell.swift
//  SwiftProject
//
//  Created by 董駸 on 2022/9/5.
//

import UIKit

class FQAnswerCollectionViewCell: UICollectionViewCell {
    var titleLb = QMUILabel(font: .mSFont(16), textColor: .color51)
    var detailLb = QMUILabel(font: .rSFont(14), textColor: .color51)
    
    var model : FQAnswerModel! {
        didSet {
            titleLb.text = model.model.question
            detailLb.text = model.model.answer
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        layer.cornerRadius = 8
        clipsToBounds = true
        backgroundColor = .white
        
        titleLb.qmui_borderWidth = 1
        titleLb.qmui_borderColor = .color238
        titleLb.qmui_borderPosition = .bottom
        contentView.addSubview(titleLb)
        
        titleLb.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.top.equalToSuperview()
            make.height.equalTo(49)
        }
        
        detailLb.numberOfLines = 0
        contentView.addSubview(detailLb)
        
        detailLb.snp.makeConstraints { make in
            make.left.right.equalTo(titleLb)
            make.top.equalTo(titleLb.snp.bottom).offset(15)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
